<template>
  <div class="accountadd">
    <div class="head">
      <h3>账号添加</h3>
    </div>
    <div class="main">
      <div class="item">
        <div style="margin-right: 10px">账号</div>
        <div><el-input v-model="account"></el-input></div>
      </div>
      <div class="item">
        <div style="margin-right: 10px">密码</div>
        <div><el-input v-model="password" show-password></el-input></div>
      </div>
      <div class="item">
        <div style="margin-right: 10px">用户组</div>
        <div>
          <el-select v-model="userGroup" placeholder="请选择">
            <el-option value="超级管理员" />
            <el-option value="普通管理员" />
          </el-select>
        </div>
      </div>
      <div class="item">
        <el-button type="primary" @click="clickadd">添加</el-button>
        <el-button @click="reset">重置</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { $_addacount } from "@/apis/user";
export default {
  data() {
    return {
      account: "",
      password: "",
      userGroup: "普通管理员",
    };
  },
  methods: {
    reset() {
      this.account = "";
      this.password = "";
      this.userGroup = "普通管理员";
    },
    clickadd() {
      $_addacount({
        account: this.account,
        password: this.password,
        userGroup: this.userGroup,
      }).then((res) => {
        console.log(res);
      });
      this.reset();
    },
  },
};
</script>

<style lang='less' scoped>
.accountadd {
  width: 98%;
  height: 100%;
  padding: 10px;
  background-color: #fff;
  box-shadow: 0 0 20px #212121;
  .head {
    height: 50px;
    padding: 0 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #bdbdbd;
  }
  .main {
    padding: 20px;
    .item {
      margin: 20px;
      display: flex;
      align-items: center;
    }
  }
}
</style>